package com.viknix.threadpool.manager.http.handler;

import com.viknix.threadpool.manager.http.response.HttpClientResponse;
import com.viknix.threadpool.manager.http.result.HttpRestResult;

import java.lang.reflect.Type;

/**
 * @Author: Dongqi
 * @Date: 2021/11/22 10:57
 * @Version 1.0
 * @Description: Response Handler abstract interface,the actual processing of the response conversion is done by a concrete implementation class.
 */
public interface ResponseHandler<T> {
    
    /**
     * set response type.
     *
     * @param responseType responseType
     */
    void setResponseType(Type responseType);
    
    /**
     * handle response convert to HttpRestResult.
     *
     * @param response http response
     * @return HttpRestResult {@link HttpRestResult}
     * @throws Exception ex
     */
    HttpRestResult<T> handle(HttpClientResponse response) throws Exception;
    
}
